#!/bin/bash
#加密
encrypt(){
 java -cp common-secure-1.2.0-SNAPSHOT.jar com.tyros.common.secure.CryptBoostrap aes_gcm_encrypt password=$password,data=$1
}
#解密
decrypt(){
  java -cp common-secure-1.2.0-SNAPSHOT.jar com.tyros.common.secure.CryptBoostrap aes_gcm_decrypt password=$password,data=$1
}
tip(){
 echo "Usage: sh crypt.sh decrypt|encrypt password input"
}
case $1 in
encrypt)
  echo "执行加密..."
  shift
  if [ $o# -lt 2 ];then
     tip
     exit 2
  fi
  password=$1
  shift
  encrypt $1
;;
decrypt)
  echo "执行解密..."
  shift
    if [ $# -lt 2 ];then
     tip
     exit 2
  fi
  password=$1
  shift
  decrypt $1
;;
*)
  tip
exit 1
esac
exit 0

